<?php

namespace App\Console;

use App\Console\Commands\AccumulatePartnerCommission;
use App\Console\Commands\BuildCommodityActivitiesName;
use App\Console\Commands\EditOfficialAccountMenu;
use App\Console\Commands\RetryAfterPlacingOrdersJob;
use App\Console\Commands\GetBatchgetMaterial;
use App\Console\Commands\GetFZTPaymentOrderDetail;
use App\Console\Commands\GetFZTPaymentOrderStatusByOrderCreatedAt;
use App\Console\Commands\HandleTopUpOrderPayment;
use App\Console\Commands\RecalculateAgentRelationships;
use App\Console\Commands\RecalculateTheAffiliatedPartner;
use App\Console\Commands\RestoreOrdersByCancelled;
use App\Console\Commands\Test;
use App\Jobs\DailyStatisticsJob;
use App\Jobs\PromotionJob;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
//        MigrateOldSystemAgentBasicData::class,
//        MigrateOldSystemAgentPerformance::class,
//        MigrateOldSystemAgentTeamPerformance::class,
        EditOfficialAccountMenu::class,
        GetBatchgetMaterial::class,
        RetryAfterPlacingOrdersJob::class,
//        RemovePersonalPerformanceFromTeamPerformance::class,
//        RemoveHistoryPerformance::class,
//        RemoveTeamCommission::class,
        GetFZTPaymentOrderDetail::class,
        HandleTopUpOrderPayment::class,
        RestoreOrdersByCancelled::class,
//        RebuildAgentParentPathId::class,
        GetFZTPaymentOrderStatusByOrderCreatedAt::class,
//        AggregatePartnerCommission::class, // 计算合伙人佣金
//        AccumulatePartnerCommission::class, // 累加合伙人佣金
        RecalculateTheAffiliatedPartner::class, // (按照当前上级路径) 重新计算 所属合伙人
//        BuildCommodityActivitiesName::class, // 找没有活动名称的活动再根据商品名称作为活动名称
        RecalculateAgentRelationships::class, // 计算所有用户的上下级关系
        Test::class, // 控制台测试
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->job(new PromotionJob())->daily(); // 晋升
        $schedule->job(new DailyStatisticsJob, 'daily_statistics')->dailyAt('03:00'); // 首页 统计任务
    }
}
